package com.timoon.sample.page;

import org.apache.wicket.markup.head.CssHeaderItem;
import org.apache.wicket.markup.head.IHeaderResponse;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.wicket.request.resource.CssResourceReference;

import com.googlecode.wicket.jquery.ui.Options;
import com.timoon.app.resource.css.CSSLocation;
import com.timoon.component.behavior.bootstrap.AbstractBootStrapBehavior;
import com.timoon.component.panel.common.DefaultEmptyPanel;
import com.timoon.sample.utils.SystemConfig;
import com.timoon.webcomponent.utility.form.form1.Form1Panel;
import com.timoon.webcomponent.utility.header.Header1Panel;
import com.timoon.webcomponent.utility.navs.jd.JdNavPanel;
import com.timoon.webcomponent.utility.product.single.BaseSingleProductPanel;

/**
 *<p>一个商品的详情界面</p>
 *<p></p>
 *<p>Copyright:Copyright(c)2013.4.1</p>
 *<p>Company:timoon</p>
 *@author 付乐天
 *@version 1.0 */
public class SingleProductPage extends WebPage {

	private PageParameters pageParameters;
	
	public SingleProductPage(PageParameters pageParameters) {
		// TODO Auto-generated constructor stub
		
		this.pageParameters=pageParameters;
		
		this.renderPanel();
	}
	
	private void renderPanel() {
		// TODO Auto-generated method stub
		
		//引用bootstrap
		this.add(new AbstractBootStrapBehavior("#ddddddd", "click", new Options()));
		
		renderMainNav();
		
		//this.renderShoppingCart();
		
		//this.renderSearchForm();
		
		//this.renderLogo();
		
		renderHeader();
		
		//一个商品的详情画面
		renderSingleProduct();
	}
	

	private void renderHeader() {
		// TODO Auto-generated method stub
		add(new Header1Panel("wk_header"));
	}

	private void renderMainNav() {
		// TODO Auto-generated method stub
		add(new JdNavPanel("wk_main_nav", SystemConfig.getNavParameters()));
	}

	private void renderSingleProduct() {
		// TODO Auto-generated method stub
		add(new BaseSingleProductPanel("wk_product_detail", pageParameters));
	}

	private void renderShoppingCart() {
		// TODO Auto-generated method stub
		add(new DefaultEmptyPanel("wk_shopping_cart","购物车"));
	}

	private void renderSearchForm() {
		// TODO Auto-generated method stub
		add(new Form1Panel("wk_search_form",CategoryProductPage.class));
	}

	private void renderLogo() {
		// TODO Auto-generated method stub
		add(new DefaultEmptyPanel("wk_logo","logo"));
	}
	@Override
	public void renderHead(IHeaderResponse response) {
		// TODO Auto-generated method stub
		super.renderHead(response);
		
		response.render(CssHeaderItem.forReference(new CssResourceReference(CSSLocation.class,"web.css")));
	}
}
